$(function(){
    $("#page_select").change(function(){
        location.href =$(this).attr("data-href")+"?pageSize="+this.value;
    })

    $("input[name='cb_select_all']").change(function(){
        $("input[name='cb_select']").prop('checked',this.checked);
    })

    $("#btn_search").click(function () {
        let form = this.form;
        form.submit();
    })

    $("#btn_del_batch").click(function () {
        let ids = [];
        $("input[name='cb_select']:checked").each(function(index,item){
            ids.push(item.value);
        });
        if (ids.length > 0) {

            let f = confirm("是否删除记录");
            if (f) {
                location.href = "delBatch.do?ids=" + ids;
            }
        }
    })


    $(".btn_del").click(function () {
        let href = $(this).attr("data-href");
        let f = confirm("是否删除记录");
        if (f) {
            location.href = href;
        }
    });

    $(".btn_edit").click(function () {
        let href = $(this).attr("data-href");
            location.href = href;

    });

    $("#btn_add").click(function () {
        location.href ="/add.html";
    });

    $("#loginout").click(function () {
        location.href = "/loginout.do";
    });
})